#include <cstdio>
#include <ctime>
#include <cmath>

int getIterTime(double x)
{
   if (fabs(x - 1.0) < 1.0e-4 || fabs(x - 2.0) < 1.0e-4)
   {
       return 0;
   }

   if (x < 1.0)
   {
       double res = (1.0 - x) * 2e12;
       return (int)(pow(res, 1.0/3.0));
   }
   else
   {
       double res = (2.0 - x) * 2e12;
       return (int)(pow(res, 1.0/3.0));
   }
}

int main()
{
    double sum = 0.0;

    clock_t begTime = clock();

    for (double x = 0.0000; x < 0.9999; x += 0.0010)
    {
        sum = 0.0;

        int iterTime = getIterTime(x);
        
        for (int k = 1; k <= iterTime; k += 1)
        {
            sum += ( (1.0-x) / (1.0 * k * (k+x) * (k+1.0)) );
        }
        sum += ( (1.0 - x) / (2.0 * iterTime * iterTime) + 1.0 );

        printf("%5.3f %16.12f\n", x, sum);
    }

    printf("%5.3f %16.12f\n", 1.0, 1.0);

    for (double x = 1.0010; x < 1.9999; x += 0.0010)
    {
        sum = 0.0;

        int iterTime = getIterTime(x);
        
        for (int k = 1; k <= iterTime; k++)
        {
            sum += ( (2.0-x) / (1.0 * k * (k+x) * (k+2)) );
        }
        sum += ( (2.0 - x) / (2 * iterTime * iterTime) + 0.75 );

        printf("%5.3f %16.12f\n", x, sum);
    }

    printf("%5.3f %16.12f\n", 2.0, 0.75);

    clock_t endTime = clock();
    //printf("Time: %d", (int)(endTime-begTime));


    return 0;
}
